package com.jelly.io.write;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * 存储和恢复数据
 * @author Jelly
 *
 */
public class StoringAndRecoveringData {
	public static void main(String[] args) throws Exception {
		DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("Data.txt")));
		out.writeDouble(3.14);
		out.writeUTF("段");
		out.writeInt(12);
		out.close();
		DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream("Data.txt")));
		System.out.println(input.readDouble());
		System.out.println(input.readUTF());
		System.out.println(input.readInt());
		input.close();
	}
}
